<template>
  <div class="singer_main">
    <div class="singer_list">
      <div
        class="singer_list_item"
        v-for="(item, index) in singerListData"
        :key="index"
      >
        <div class="singerImage">
          <el-image
            style="width: 100px; height: 100px"
            :src="item.picUrl"
            fit="cover"
          ></el-image>
        </div>
        <div class="singerInfo">
          <div class="singerName">{{ item.name }}</div>
          <div class="singerSongNum">
            <div class="singerSongNum_item">
              <div>专辑</div>
              <span>{{ item.albumSize }}</span>
            </div>
            <div class="singerSongNum_item">
              <div>单曲</div>
              <span>{{ item.musicSize }}</span>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="singer_search">
      <div
        class="singer_search_item"
        v-for="(item, index) in searchTagOption"
        :key="index"
      >
        <span
          class="searchTag"
          v-for="(jitem, index) in item.tagList"
          :key="index"
        >
          {{ jitem }}
        </span>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref, reactive, toRefs, onMounted, inject } from "vue";
const axios = inject("$axios");
const singerListData = ref([]);
const searchTagOption = ref([
  {
    tagList: [
      "全部",
      "A",
      "B",
      "C",
      "D",
      "E",
      "F",
      "G",
      "H",
      "I",
      "J",
      "K",
      "L",
      "M",
      "N",
      "O",
      "P",
      "Q",
    ],
  },
  {
    tagList: ["全部", "华语", "欧美", "日本", "韩国", "其他"],
  },
  {
    tagList: ["全部", "男歌手", "女歌手", "乐队"],
  },
]);

const getHotRecommend = async () => {
  const { data: resData } = await axios.get(
    "http://127.0.0.1:3000/artist/list?type=&area=&initial=&limit=30&offset=0"
  );
  singerListData.value = resData.artists;
};

onMounted(() => {
  getHotRecommend();
});
</script>
<style scoped lang="scss">
.singer_main {
  display: flex;
  justify-content: space-around;

  .singer_list {
    flex: 1;
    box-sizing: border-box;
    margin-right: 15px;
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;

    .singer_list_item {
      width: 30%;
      box-sizing: border-box;
      background-color: #fff;
      padding: 10px;
      border-radius: 10px;
      height: 120px;
      display: flex;
      justify-content: flex-start;
      margin-bottom: 20px;

      .singerImage {
        width: 100px;
        background-color: aliceblue;
        margin-right: 20px;
        border-radius: 5px;
      }
      .singerInfo {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: space-around;
        .singerName {
          font-size: 18px;
          margin-bottom: 10px;
        }
        .singerSongNum {
          display: flex;
          align-items: center;
          justify-content: flex-start;
          font-size: 12px;
          .singerSongNum_item {
            flex: 1;
            div {
              color: #999;
            }
            span {
              font-weight: bold;
            }
          }
        }
      }
    }
  }

  .singer_search {
    width: 380px;
    background-color: #fff;
    height: 100%;
    box-sizing: border-box;
    padding: 15px;
    border-radius: 10px;

    .singer_search_item {
      border-bottom: 1px #f3f3f3 solid;
      margin-bottom: 10px;
      .searchTag {
        display: inline-block;
        width: 40px;
        height: 20px;
        background-color: aliceblue;
        margin-right: 10px;
        padding: 5px 10px;
        text-align: center;
        font-size: 12px;
        margin-bottom: 10px;
        border-radius: 3px;
        cursor: pointer;
      }
    }
  }
}
</style>